import { Injectable } from '@angular/core';
import {Http} from '@angular/http';
import {Observable} from 'rxjs';
import {map} from 'rxjs/internal/operators';

@Injectable({
  providedIn: 'root'
})
export class IndexService {

  constructor(private http: Http) {}

  public takeBackImage(): Observable<any> {
    return this.http.get('http://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1').pipe(
      map(res => res.json())
    );
  }
}
